# file: launch/avoidance.launch.py
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.substitutions import LaunchConfiguration
from launch.actions import DeclareLaunchArgument

def generate_launch_description():
    return LaunchDescription([
        DeclareLaunchArgument('forward_speed', default_value='0.3'),
        DeclareLaunchArgument('turn_speed', default_value='0.8'),
        DeclareLaunchArgument('obstacle_distance', default_value='2'),
        DeclareLaunchArgument('front_sector_deg', default_value='60'),

        Node(
            package='sls_launch_sim',  # 替换为你的包名
            executable='obstacle_avoider',
            name='obstacle_avoider',
            output='screen',
            parameters=[{
                'forward_speed': LaunchConfiguration('forward_speed'),
                'turn_speed': LaunchConfiguration('turn_speed'),
                'obstacle_distance': LaunchConfiguration('obstacle_distance'),
                'front_sector_deg': LaunchConfiguration('front_sector_deg'),
                'use_sim_time': True,
            }]
        )
    ])